package com.luanye.enjoy.controller;

import com.luanye.enjoy.service.RecipeService;
import com.luanye.enjoy.vo.RespBean;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/recipe")
@AllArgsConstructor
public class RecipeController {

    private final RecipeService recipeService;

    @GetMapping("/{id}")
    public RespBean finaByType(@PathVariable("id") Integer id){
        return recipeService.findByType(id);
    }

    @GetMapping("/by")
    public RespBean findByName(String name){
        return recipeService.findByName(name);
    }
}
